/*
 * Decompiled with CFR 0.150.
 * 
 * Could not load the following classes:
 *  cn.hutool.core.date.DateUtil
 *  cn.hutool.core.util.ObjectUtil
 *  com.alibaba.fastjson.JSON
 *  de.felixroske.jfxsupport.FXMLController
 *  javafx.beans.value.ChangeListener
 *  javafx.beans.value.ObservableValue
 *  javafx.collections.FXCollections
 *  javafx.collections.ObservableList
 *  javafx.event.ActionEvent
 *  javafx.event.EventHandler
 *  javafx.fxml.FXML
 *  javafx.fxml.Initializable
 *  javafx.geometry.Insets
 *  javafx.scene.Node
 *  javafx.scene.control.Alert
 *  javafx.scene.control.Alert$AlertType
 *  javafx.scene.control.Button
 *  javafx.scene.control.CheckBox
 *  javafx.scene.control.ComboBox
 *  javafx.scene.control.DatePicker
 *  javafx.scene.control.ScrollPane
 *  javafx.scene.control.TableCell
 *  javafx.scene.control.TableColumn
 *  javafx.scene.control.TableView
 *  javafx.scene.control.TextField
 *  javafx.scene.control.cell.PropertyValueFactory
 *  javafx.scene.input.KeyCode
 *  javafx.scene.input.KeyEvent
 *  javafx.scene.layout.AnchorPane
 *  javafx.scene.layout.HBox
 *  javafx.scene.layout.VBox
 *  javafx.scene.text.Text
 *  javafx.stage.Modality
 *  javafx.util.Callback
 *  javafx.util.StringConverter
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 *  org.springframework.beans.BeanUtils
 *  org.springframework.beans.factory.annotation.Autowired
 *  org.springframework.util.CollectionUtils
 */
package com.gys.controller.clearBox;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.gys.GysApplication;
import com.gys.common.business.ClearBoxUtil;
import com.gys.common.business.SalesReceiptsUtil;
import com.gys.common.data.HttpJson;
import com.gys.common.data.KeyValue;
import com.gys.common.util.CommonUtil;
import com.gys.controller.BaseController;
import com.gys.controller.clearBox.AddClearBoxController;
import com.gys.controller.clearBox.ExamineTipController;
import com.gys.controller.dataManger.ControllerManger;
import com.gys.controller.index.IndexController;
import com.gys.data.clearBox.ClearBoxDetailOutData;
import com.gys.data.clearBox.ClearBoxInfoInData;
import com.gys.data.clearBox.ClearBoxInfoOutData;
import com.gys.data.clearBox.GetOneClearBoxOutData;
import com.gys.data.salesReceipts.GetDoctorOutData;
import com.gys.view.clearBox.AddClearBoxView;
import com.gys.view.clearBox.ExamineTipView;
import de.felixroske.jfxsupport.FXMLController;
import java.lang.reflect.Method;
import java.net.URL;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.ResourceBundle;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.DatePicker;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Modality;
import javafx.util.Callback;
import javafx.util.StringConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;

@FXMLController
public class ClearBoxController
extends BaseController
implements Initializable {
    private static final Logger log = LoggerFactory.getLogger(ClearBoxController.class);
    @FXML
    private HBox boxView;
    @FXML
    private VBox vBox;
    @FXML
    private TextField gschVoucherIdQuery;
    @FXML
    private TextField gscdBatchNoQuery;
    @FXML
    private TextField gscdProIdQuery;
    @FXML
    private HBox queryHbox;
    @FXML
    private TableView<ClearBoxInfoOutData> tableViewTwo;
    @FXML
    private TableColumn<ClearBoxInfoOutData, CheckBox> checkBox;
    @FXML
    private TableColumn<ClearBoxInfoOutData, String> gschDate;
    @FXML
    private TableColumn<ClearBoxInfoOutData, String> gschStatus;
    @FXML
    private TableColumn<ClearBoxInfoOutData, String> gschVoucherId;
    @FXML
    private TableColumn<ClearBoxInfoOutData, String> index;
    @FXML
    private TableColumn<ClearBoxInfoOutData, String> gschEmp;
    @FXML
    private TableColumn<ClearBoxInfoOutData, String> gschRemaks;
    @FXML
    private TableView<ClearBoxDetailOutData> tableViewThree;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> proForm;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> proSpecs;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> proPlace;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> proUnit;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> gsadStockStatus;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> gscdValidDate;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> gscdProId;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> gscdProName;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> proRegisterNo;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> proFactoryName;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> gscdQty;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> gscdBatchNo;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> indexDetail;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> normalPrice;
    @FXML
    private TableColumn<ClearBoxDetailOutData, String> gscdBatch;
    @FXML
    private AnchorPane anchorPane;
    @FXML
    private Button enterBtn;
    @FXML
    private ComboBox<KeyValue> gschStatusQuery;
    @FXML
    private ScrollPane scrollPane;
    @FXML
    private Insets tableViewTwoInsets;
    @FXML
    private Button approveBtn;
    @FXML
    private HBox queryHbox1;
    @FXML
    private DatePicker gschDateQuery;
    @FXML
    private ComboBox<KeyValue> gschEmpQuery;
    @FXML
    private HBox boxViewTwo;
    @Autowired
    private ExamineTipController examineTipController;
    @Autowired
    private IndexController indexController;
    @Autowired
    private AddClearBoxController addClearBoxController;
    private ObservableList<ClearBoxInfoOutData> observableTableTwoList = FXCollections.observableArrayList(new ArrayList());
    private ObservableList<ClearBoxDetailOutData> observableTableThreeList = FXCollections.observableArrayList(new ArrayList());
    public ObservableList<KeyValue> gsegNameOptions;

    public void initialize(URL location, ResourceBundle resources) {
        this.scrollPane.setPrefWidth(this.getContentWidth());
        this.scrollPane.setPrefHeight(this.getContentHeight());
        this.vBox.setPrefWidth(this.getContentWidth());
        this.tableViewTwo.setPrefWidth(this.getContentWidth());
        this.tableViewThree.setPrefWidth(this.getContentWidth());
        ControllerManger.controllerMap.put(this.getClass().getSimpleName(), this);
        this.bingTableCell();
        StringConverter converter = CommonUtil.dataPickerFormat("yyyyMMdd");
        this.gschDateQuery.setConverter(converter);
        ArrayList<KeyValue> gschStatusOptionList = new ArrayList<KeyValue>();
        gschStatusOptionList.add(new KeyValue("\u672a\u6e05\u6597", "0"));
        gschStatusOptionList.add(new KeyValue("\u5df2\u6e05\u6597", "1"));
        ObservableList gschStatusOptions = FXCollections.observableArrayList(gschStatusOptionList);
        this.gschStatusQuery.setItems(gschStatusOptions);
        this.comboxInit(this.gschStatusQuery);
        this.gschStatusQuery.setPrefHeight(35.0);
        List<GetDoctorOutData> outDataList = new ArrayList();
        HttpJson httpJson = SalesReceiptsUtil.queryDruggist(new HashMap<String, Object>());
        if (!httpJson.isSuccess()) {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", httpJson.getMsg());
            alert.showAndWait();
            return;
        }
        outDataList = JSON.parseArray((String)httpJson.getMsg(), GetDoctorOutData.class);
        ArrayList gsegNameOptionList = new ArrayList();
        outDataList.forEach(item -> gsegNameOptionList.add(new KeyValue(item.getName(), item.getId())));
        this.gsegNameOptions = FXCollections.observableArrayList(gsegNameOptionList);
        this.gschEmpQuery.setItems(this.gsegNameOptions);
        this.comboxInit(this.gschEmpQuery);
        this.gschEmpQuery.setPrefHeight(35.0);
        this.init();
    }

    @Override
    public void init() {
        if (ObjectUtil.isEmpty(this.tableViewTwo)) {
            return;
        }
        this.indexController.scrollContentPane.setOnKeyReleased((EventHandler)new EventHandler<KeyEvent>(){

            public void handle(KeyEvent e) {
                if (e.getCode() == KeyCode.ENTER) {
                    ClearBoxController.this.sureAction();
                } else if (e.getCode() == KeyCode.F8) {
                    ClearBoxController.this.examineAction();
                } else if (e.getCode() == KeyCode.F1) {
                    ClearBoxController.this.getExamineAction();
                } else if (e.getCode() == KeyCode.F11) {
                    ClearBoxController.this.addAction();
                }
                e.consume();
            }
        });
        this.gschVoucherIdQuery.clear();
        this.gscdProIdQuery.clear();
        this.gscdBatchNoQuery.clear();
        this.gschDateQuery.setValue(null);
        this.gschStatusQuery.setValue(new KeyValue());
        this.gschEmpQuery.setValue(new KeyValue());
        this.initCheckBox();
        this.initTableViewTwo();
    }

    public void initCheckBox() {
        this.checkBox.setCellFactory(col -> {
            TableCell<ClearBoxInfoOutData, CheckBox> cell = new TableCell<ClearBoxInfoOutData, CheckBox>(){

                protected void updateItem(CheckBox item, boolean empty) {
                    super.updateItem(item, empty);
                    this.setGraphic((Node)item);
                    if (item != null) {
                        item.setOnMouseClicked(col -> {
                            if (CollectionUtils.isEmpty((Collection)ClearBoxController.this.observableTableTwoList)) {
                                return;
                            }
                            int index = this.getIndex();
                            for (int i = 0; i < ClearBoxController.this.observableTableTwoList.size(); ++i) {
                                if (i == index) continue;
                                ((ClearBoxInfoOutData)ClearBoxController.this.observableTableTwoList.get(i)).getCheckBox().setSelectStatus(false);
                            }
                            if (!((ClearBoxInfoOutData)ClearBoxController.this.observableTableTwoList.get(index)).getCheckBox().isSelected().booleanValue()) {
                                ClearBoxController.this.observableTableThreeList.clear();
                                return;
                            }
                            HashMap<String, Object> param = new HashMap<String, Object>();
                            param.put("gschVoucherId", ((ClearBoxInfoOutData)ClearBoxController.this.observableTableTwoList.get(index)).getGschVoucherId());
                            HttpJson httpJson = ClearBoxUtil.getOneClearBox(param);
                            GetOneClearBoxOutData outData = null;
                            if (httpJson.isSuccess()) {
                                ClearBoxController.this.observableTableThreeList.clear();
                                outData = (GetOneClearBoxOutData)JSON.parseObject((String)httpJson.getMsg(), GetOneClearBoxOutData.class);
                                for (int i = 0; i < outData.getGaiaSdCleandrawerDList().size(); ++i) {
                                    outData.getGaiaSdCleandrawerDList().get(i).setIndexDetail(String.valueOf(i + 1));
                                    String normalPrice = outData.getGaiaSdCleandrawerDList().get(i).getNormalPrice();
                                    normalPrice = String.format("%.2f", Double.valueOf(normalPrice));
                                    outData.getGaiaSdCleandrawerDList().get(i).setNormalPrice(normalPrice);
                                }
                                ClearBoxController.this.observableTableThreeList = FXCollections.observableArrayList(outData.getGaiaSdCleandrawerDList());
                                ClearBoxController.this.tableViewThree.setItems(ClearBoxController.this.observableTableThreeList);
                                if ("\u672a\u6e05\u6597".equals(outData.getGaiaSdCleandrawerH().getGschStatus())) {
                                    ClearBoxController.this.gscdQtyToTextField();
                                } else {
                                    ClearBoxController.this.gscdQtyToText();
                                }
                            } else {
                                Alert alert = ClearBoxController.this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", httpJson.getMsg());
                                alert.showAndWait();
                            }
                        });
                    }
                }
            };
            return cell;
        });
    }

    public void initTableViewTwo() {
        HttpJson httpJson;
        List dataList = new ArrayList();
        HashMap<String, Object> param = new HashMap<String, Object>();
        param.put("gschVoucherId", this.gschVoucherIdQuery.getText());
        if (ObjectUtil.isNotEmpty(this.gschStatusQuery.getValue())) {
            param.put("gschStatus", ((KeyValue)this.gschStatusQuery.getValue()).getValue());
        }
        if (ObjectUtil.isNotEmpty(this.gschEmpQuery.getValue())) {
            param.put("gschEmp", ((KeyValue)this.gschEmpQuery.getValue()).getValue());
        }
        param.put("proId", this.gscdProIdQuery.getText());
        param.put("gscdBatchNo", this.gscdBatchNoQuery.getText());
        if (ObjectUtil.isNotEmpty(this.gschDateQuery.getValue())) {
            param.put("gschDate", DateUtil.format((Date)DateUtil.parse((String)((LocalDate)this.gschDateQuery.getValue()).toString()), (String)"yyyyMMdd"));
        }
        if (!(httpJson = ClearBoxUtil.getClearBox(param)).isSuccess()) {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", httpJson.getMsg());
            alert.showAndWait();
            return;
        }
        dataList = JSON.parseArray((String)httpJson.getMsg(), ClearBoxInfoOutData.class);
        this.observableTableTwoList = FXCollections.observableArrayList(dataList);
        this.bingTableCell();
        this.checkBox.setCellValueFactory(cellData -> ((ClearBoxInfoOutData)cellData.getValue()).getCheckBox().getCustomCheckBox());
        this.tableViewTwo.setItems(this.observableTableTwoList);
        this.gsegChangeToComBoxEdit(this.gschEmp);
        this.observableTableThreeList.clear();
        this.tableViewThree.setItems(this.observableTableThreeList);
    }

    private void bingTableCell() {
        this.checkBox.setCellValueFactory((Callback)new PropertyValueFactory(this.checkBox.getId()));
        this.index.setCellValueFactory((Callback)new PropertyValueFactory(this.index.getId()));
        this.gschVoucherId.setCellValueFactory((Callback)new PropertyValueFactory(this.gschVoucherId.getId()));
        this.gschDate.setCellValueFactory((Callback)new PropertyValueFactory(this.gschDate.getId()));
        this.gschStatus.setCellValueFactory((Callback)new PropertyValueFactory(this.gschStatus.getId()));
        this.gschEmp.setCellValueFactory((Callback)new PropertyValueFactory(this.gschEmp.getId()));
        this.gschRemaks.setCellValueFactory((Callback)new PropertyValueFactory(this.gschRemaks.getId()));
        this.indexDetail.setCellValueFactory((Callback)new PropertyValueFactory(this.indexDetail.getId()));
        this.gscdProId.setCellValueFactory((Callback)new PropertyValueFactory(this.gscdProId.getId()));
        this.gscdProName.setCellValueFactory((Callback)new PropertyValueFactory(this.gscdProName.getId()));
        this.normalPrice.setCellValueFactory((Callback)new PropertyValueFactory(this.normalPrice.getId()));
        this.gscdBatchNo.setCellValueFactory((Callback)new PropertyValueFactory(this.gscdBatchNo.getId()));
        this.gscdBatch.setCellValueFactory((Callback)new PropertyValueFactory(this.gscdBatch.getId()));
        this.gscdValidDate.setCellValueFactory((Callback)new PropertyValueFactory(this.gscdValidDate.getId()));
        this.gscdQty.setCellValueFactory((Callback)new PropertyValueFactory(this.gscdQty.getId()));
        this.proFactoryName.setCellValueFactory((Callback)new PropertyValueFactory(this.proFactoryName.getId()));
        this.proPlace.setCellValueFactory((Callback)new PropertyValueFactory(this.proPlace.getId()));
        this.proForm.setCellValueFactory((Callback)new PropertyValueFactory(this.proForm.getId()));
        this.proUnit.setCellValueFactory((Callback)new PropertyValueFactory(this.proUnit.getId()));
        this.proSpecs.setCellValueFactory((Callback)new PropertyValueFactory(this.proSpecs.getId()));
        this.proRegisterNo.setCellValueFactory((Callback)new PropertyValueFactory(this.proRegisterNo.getId()));
        this.gsadStockStatus.setCellValueFactory((Callback)new PropertyValueFactory(this.gsadStockStatus.getId()));
    }

    @FXML
    private void getExamineAction() {
        this.examineTipController.init();
        GysApplication.showView(ExamineTipView.class, (Modality)Modality.APPLICATION_MODAL);
    }

    public void clearBoxByExa(String gschVoucherId) {
        HashMap<String, Object> param = new HashMap<String, Object>();
        param.put("gschVoucherId", gschVoucherId);
        HttpJson httpJson = ClearBoxUtil.getOneClearBox(param);
        GetOneClearBoxOutData outData = null;
        if (httpJson.isSuccess()) {
            this.observableTableTwoList.clear();
            this.observableTableThreeList.clear();
            outData = (GetOneClearBoxOutData)JSON.parseObject((String)httpJson.getMsg(), GetOneClearBoxOutData.class);
            ClearBoxInfoOutData infoOutData = outData.getGaiaSdCleandrawerH();
            infoOutData.setIndex("1");
            ArrayList<ClearBoxInfoOutData> dataList = new ArrayList<ClearBoxInfoOutData>();
            dataList.add(infoOutData);
            this.observableTableTwoList = FXCollections.observableArrayList(dataList);
            this.tableViewTwo.setItems(this.observableTableTwoList);
            this.checkBox.setCellValueFactory(cellData -> ((ClearBoxInfoOutData)cellData.getValue()).getCheckBox().getCustomCheckBox());
            this.gsegChangeToComBoxEdit(this.gschEmp);
            for (int i = 0; i < outData.getGaiaSdCleandrawerDList().size(); ++i) {
                outData.getGaiaSdCleandrawerDList().get(i).setIndexDetail(String.valueOf(i + 1));
            }
            this.observableTableThreeList = FXCollections.observableArrayList(outData.getGaiaSdCleandrawerDList());
            this.tableViewThree.setItems(this.observableTableThreeList);
            this.gscdQtyToTextField();
        } else {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", httpJson.getMsg());
            alert.showAndWait();
        }
    }

    public void gscdQtyToText() {
        this.gscdQty.setCellFactory(tc -> {
            final Text text = new Text();
            TableCell<ClearBoxDetailOutData, String> cell = new TableCell<ClearBoxDetailOutData, String>(){

                protected void updateItem(String chuzhi, boolean empty) {
                    super.updateItem(chuzhi, empty);
                    if (empty) {
                        this.setGraphic(null);
                    } else {
                        text.setText(chuzhi);
                        this.setGraphic((Node)text);
                    }
                }
            };
            return cell;
        });
    }

    public void gscdQtyToTextField() {
        this.gscdQty.setCellFactory(tc -> {
            final TextField textField = new TextField();
            textField.setMinHeight(30.0);
            textField.setPrefWidth(90.0);
            TableCell<ClearBoxDetailOutData, String> cell = new TableCell<ClearBoxDetailOutData, String>(){

                protected void updateItem(String chuzhi, boolean empty) {
                    super.updateItem(chuzhi, empty);
                    if (empty) {
                        this.setGraphic(null);
                    } else {
                        textField.setText(chuzhi);
                        this.setGraphic((Node)textField);
                    }
                }
            };
            textField.textProperty().addListener((ChangeListener)new ChangeListener<String>(){
                final TableCell val_cell;
                {
                    this.val_cell = cell;
                }

                public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
                    int rank = this.val_cell.getIndex();
                    if (ObjectUtil.isNotEmpty(newValue) && !CommonUtil.positiveInteger(newValue)) {
                        Alert alert = ClearBoxController.this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u8bf7\u8f93\u5165\u6b63\u6574\u6570");
                        alert.showAndWait();
                        return;
                    }
                    ((ClearBoxDetailOutData)ClearBoxController.this.observableTableThreeList.get(rank)).setGscdQty(newValue);
                }
            });
            return cell;
        });
    }

    public void gsegChangeToComBoxEdit(TableColumn<ClearBoxInfoOutData, String> column) {
        column.setCellFactory(tc -> {
            final ComboBox combo = new ComboBox();
            combo.setItems(this.gsegNameOptions);
            combo.setEditable(false);
            combo.setMinHeight(30.0);
            combo.setPrefWidth(150.0);
            this.comboxInit(combo);
            TableCell<ClearBoxInfoOutData, String> cell = new TableCell<ClearBoxInfoOutData, String>(){

                protected void updateItem(String chuzhi, boolean empty) {
                    super.updateItem(chuzhi, empty);
                    if (empty) {
                        this.setGraphic(null);
                    } else if ("\u5df2\u6e05\u6597".equals(((ClearBoxInfoOutData)ClearBoxController.this.observableTableTwoList.get(this.getIndex())).getGschStatus())) {
                        Text text = new Text();
                        text.setText(chuzhi);
                        this.setGraphic((Node)text);
                    } else {
                        this.setGraphic((Node)combo);
                    }
                }
            };
            combo.setOnAction(arg_0 -> this.lambda$null$6((TableCell)cell, combo, (ActionEvent) arg_0));
            return cell;
        });
    }

    public void comboxInit(ComboBox box) {
        box.converterProperty().set(new StringConverter<KeyValue>(){

            public String toString(KeyValue object) {
                return object.getName();
            }

            public KeyValue fromString(String string) {
                return null;
            }
        });
    }

    @FXML
    private void addAction() {
        this.addClearBoxController.init();
        GysApplication.showView(AddClearBoxView.class, (Modality)Modality.APPLICATION_MODAL);
    }

    @FXML
    private void examineAction() {
        Alert alert;
        int index = 0;
        for (ClearBoxInfoOutData i : this.observableTableTwoList) {
            if (!i.getCheckBox().isSelected().booleanValue()) continue;
            index = Integer.valueOf(i.getIndex());
            break;
        }
        if (index == 0) {
            Alert alert2 = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u672a\u9009\u62e9\u5bf9\u5e94\u8bb0\u5f55\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\uff01");
            alert2.showAndWait();
            return;
        }
        ClearBoxInfoOutData clearBoxInfoOutData = (ClearBoxInfoOutData)this.observableTableTwoList.get(index - 1);
        if ("\u5df2\u6e05\u6597".equals(clearBoxInfoOutData.getGschStatus())) {
            alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u5df2\u6e05\u6597,\u4e0d\u53ef\u5ba1\u6838");
            alert.showAndWait();
            return;
        }
        if (ObjectUtil.isEmpty(clearBoxInfoOutData.getGschEmp())) {
            alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u8bf7\u9009\u62e9\u6e05\u6597\u4eba\u5458");
            alert.showAndWait();
            return;
        }
        ObservableList clearBoxDetailOutData = this.tableViewThree.getItems();
        for (int i = 0; i < clearBoxDetailOutData.size(); ++i) {
            ClearBoxDetailOutData item = (ClearBoxDetailOutData)clearBoxDetailOutData.get(i);
            if (ObjectUtil.isEmpty(item.getGscdQty())) {
                Alert alert3 = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u6e05\u6597\u6570\u91cf\u8bf7\u586b\u5199\u5b8c\u6574");
                alert3.showAndWait();
                return;
            }
            if (Integer.valueOf(item.getGscdQty()) <= Integer.valueOf(item.getQtySour() == "" ? "0" : item.getQtySour())) continue;
            Alert alert4 = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u6e05\u6597\u6570\u91cf\u4e0d\u80fd\u5927\u4e8e\u6279\u53f7\u5e93\u5b58\u6570\u91cf\uff1a" + item.getQtySour());
            alert4.showAndWait();
            return;
        }
        GetOneClearBoxOutData clearBoxOutData = new GetOneClearBoxOutData();
        clearBoxOutData.setGaiaSdCleandrawerH(clearBoxInfoOutData);
        clearBoxOutData.setGaiaSdCleandrawerDList((List<ClearBoxDetailOutData>)clearBoxDetailOutData);
        HashMap<String, Object> param = new HashMap<String, Object>();
        ClearBoxInfoInData infoInData = new ClearBoxInfoInData();
        BeanUtils.copyProperties(clearBoxInfoOutData, infoInData);
        param.put("GaiaSdCleandrawerH", infoInData);
        param.put("gaiaSdCleandrawerDList", clearBoxDetailOutData);
        HttpJson httpJson = ClearBoxUtil.examine(param);
        if (httpJson.isSuccess()) {
            Alert alert5 = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u5ba1\u6838\u6210\u529f!");
            alert5.showAndWait();
            this.initTableViewTwo();
        } else {
            Alert alert6 = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u5ba1\u6838\u5931\u8d25!");
            alert6.showAndWait();
        }
    }

    @FXML
    private void sureAction() {
        if (ObjectUtil.isEmpty(this.gschVoucherIdQuery.getText()) && ObjectUtil.isEmpty(((KeyValue)this.gschStatusQuery.getValue()).getValue()) && ObjectUtil.isEmpty(((KeyValue)this.gschEmpQuery.getValue()).getValue()) && ObjectUtil.isEmpty(this.gscdProIdQuery.getText()) && ObjectUtil.isEmpty(this.gscdBatchNoQuery.getText()) && ObjectUtil.isEmpty(this.gschDateQuery.getValue())) {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u5fc5\u987b\u81f3\u5c11\u586b\u5199\u4e00\u9879\u5185\u5bb9\u8fdb\u884c\u67e5\u8be2\uff01");
            alert.showAndWait();
            return;
        }
        this.initTableViewTwo();
    }

    @FXML
    private void reset() {
        this.gschVoucherIdQuery.clear();
        this.gschStatusQuery.setValue(null);
        this.gschEmpQuery.setValue(null);
        this.gscdProIdQuery.clear();
        this.gscdBatchNoQuery.clear();
        this.gschDateQuery.setValue(null);
    }

    private void lambda$null$6(TableCell cell, ComboBox combo, ActionEvent e) {
        int rank = cell.getIndex();
        String cloumName = cell.getId();
        String value = ((KeyValue)combo.getValue()).getValue();
        String name = ((KeyValue)combo.getValue()).getName();
        ClearBoxInfoOutData outData = (ClearBoxInfoOutData)this.observableTableTwoList.get(rank);
        String methodName = CommonUtil.getSetMethod(cloumName);
        try {
            Method method = ClearBoxInfoOutData.class.getMethod(methodName, String.class);
            method.invoke(outData, value);
        }
        catch (Exception ex) {
            throw new RuntimeException("\u6ca1\u6709\u65b9\u6cd5" + methodName);
        }
    }
}

